using System;
using System.Collections.Generic;
using System.Text;

namespace TVDesigner.Generator.Components
{
    public class HText : GenericComponent
    {

        private string _Text;
        private System.Drawing.Font _Font;
        private System.Drawing.Color _Foregroud;
        private double _Alpha;
        private System.Drawing.Color _Background;

        public System.Drawing.Color Background
        {
            get { return _Background; }
            set { _Background = value; }
        }
        public double Alpha
        {
            get { return _Alpha; }
            set { _Alpha = value; }
        }
        public System.Drawing.Color Foreground
        {
            get { return _Foregroud; }
            set { _Foregroud = value; }
        }
        public string Text
        {
            get { return _Text; }
            set { _Text = value; }
        }
        public System.Drawing.Font Font
        {
            get { return _Font; }
            set { _Font = value; }
        }
        public override string TypeString
        {
            get { return "org.havi.ui.HText"; }
        }

        protected override void SetAtributes(StringBuilder sb)
        {
            if (this.Text != null && !this.Text.Equals(string.Empty))
            {
                sb.Append("\t\t\t").Append(NameStartedWithLowerCase).Append(".setHorizontalAlignment(org.havi.ui.HText.HALIGN_LEFT);\n");
                sb.Append("\t\t\t").Append(NameStartedWithLowerCase).Append(".setVerticalAlignment(org.havi.ui.HText.VALIGN_TOP);\n");

                sb.Append("\t\t\t").Append(NameStartedWithLowerCase).Append(".setTextContent(\"").Append(_Text).Append("\", org.havi.ui.HVisible.ALL_STATES);\n");
                sb.Append("\t\t\tjava.awt.Font font = new java.awt.Font(\"Arial Black\", java.awt.Font.PLAIN, 20);\n");
                sb.Append("\t\t\t").Append(NameStartedWithLowerCase).Append(".setFont(font);\n");

                sb.Append("\t\t\tjava.awt.Color color = new java.awt.Color(").Append(this.Foreground.ToArgb()).Append(");\n");
                sb.Append("\t\t\t").Append(NameStartedWithLowerCase).Append(".setForeground(color);\n");

                sb.Append("\t\t\tjava.awt.Color backgroundColor = new java.awt.Color(").Append(this.Background.ToArgb()).Append(");\n");
                sb.Append("\t\t\t").Append(NameStartedWithLowerCase).Append(".setBackground(backgroundColor);\n");
            }
        }
    }
}
